<template>
	<div class="product-detail">
    <router-link to="/act/whiteday"><img v-if="actImgShow" class="act-img" src="@/assets/images/activity/2018whiteday/detail_product.jpg" alt=""></router-link>
    <div class="product-detail-content" v-html="goodsContentItem.description"></div>
	</div>
</template>

<script>
export default {
  name: 'DetailProduct',
  props: {
    goodsContentItem: {
      type: [String, Object]
    }
  },
  data () {
    return {
      actImgShow: false // 是否显示活动图片
    }
  },
  methods: {
    // 是否显示活动图片
    initActImgShow () {
      this.$ajax.getActiveTime().then(res => {
        if (res.code === 200) {
          if (res.data.to_end > 0) this.actImgShow = true
        }
      }).catch(err => {
        this.$store.commit('alert', {switch: true, alertText: this.$t('message.errorMessage')})
      })
    }
  },
  mounted () {
    this.initActImgShow()
  }
}
</script>

<style>
.product-detail img {
  max-width: 100%;
}
.act-img {
  width: 100%;
}
.product-detail-content {
  margin-top: 24px;
}
</style>
